package com.hymjweb.demo.hymj.customer_manage.invoice.controller;

import com.hymjweb.demo.framework.sys.BaseController;
import com.hymjweb.demo.framework.util.DataTypeUtil;
import com.hymjweb.demo.hymj.customer_manage.invoice.bean.BCustomerInvoicePojo;
import com.hymjweb.demo.hymj.customer_manage.invoice.service.BCustomerInvoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/pages/customer_manage/invoice")
public class BCustomerInvoiceController extends BaseController {

    @Autowired
    private BCustomerInvoiceService bCustomerInvoiceService;

    /**
     * 根据客户id，查询对应的客户联系人
     * @param map
     * @return
     */
    @RequestMapping("/queryInvoiceByCustomerId")
    @ResponseBody
    public List<BCustomerInvoicePojo> queryInvoiceByCustomerId(@RequestBody(required = true) Map map){
        if(map!=null && map.size()>0){
            String customerId= DataTypeUtil.toNotNullString(map.get("customerId"));
            List<BCustomerInvoicePojo> invoicePojoList = bCustomerInvoiceService.queryInvoiceByCustomerId(customerId);
            return invoicePojoList;
        }
        return null;
    }


}
